import { change_input_value,add_todo_item,del_todo,initListActionS } from './actionTypes.js'
import axios from 'axios'
export const gethandleInputChangAction=(value)=>({
  type:change_input_value,
  value
})

export const gethandleBtnClick=(value)=>({
  type:add_todo_item
})

export const gethandleItemClick=(index)=>({
  type:del_todo,
  index
})

export const initListAction=(data)=>({
  type:initListActionS,
  data
})

export const getTodoList=()=>{
  return (dispatch)=>{
    let htm="https://api.mlwei.com/music/api/?key=523077333&cache=1&type=so&id=%E6%B5%81%E8%A1%8C&size=hq"
		axios.get(htm).then((res)=>{
			const data=res.data.Body
			const action=initListAction(data)
      dispatch(action)
      console.log(data)
		})
  }
}